<?php
namespace app\common\model;


class Featured extends BaseModel
{
    /**
     * 根据类型状态来获取列表数据
     * @param $type
     */
    public function getFeaturedsByTypeStatus($type,$status) {
        $data = [
            'type' => $type,
            'status' => $status,
        ];

        $order = [
            'listorder'=>'desc',
            'id'=>'desc'];

        $result = $this->where($data)
            ->order($order)
            ->paginate();
        return $result;
    }


    public function getFeaturedsByTypeStatusLimit($type,$status,$limit) {
        $data = [
            'type' => $type,
            'status' => $status,
        ];

        $order = [
            'listorder'=>'desc',
            'id'=>'desc'
        ];

        $result = $this->where($data)
            ->order($order)
            ->limit($limit)
            ->select();
        return $result;
    }
}